function formatPrivateNumber(num, front = 4, end = 4){
  let n = num.toString()
  let length = n.length - front - end
  if(n.length - front - end < 0){
    return
  }
  let r = new RegExp(`(^\\d{${front}})(\\d+)(\\d{${end}}$)`)
  let result = n.toString().replace(r, `$1${'*'.repeat(length)}$3`)
  console.log("result ==> ", result);
}

function format(num){
  let r = /(\d)(?=(\d{3})+(.\d{2})$)/gm
  let str = num.toString()
  let result = str.replace(r, '$1,')
  console.log("result ==> ", result)
}

formatPrivateNumber('441900199808081234')
format(2154562.32)


let reg = /^\_.*?js$/gm